package com.itheima.spring.processor;

import com.itheima.spring.test.impl.BImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @author ：sean
 * @date ：Created in 2020/7/7
 * @description ：
 * @version: 1.0
 */
@Component
public class HmBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
		System.out.println("postProcessBeanFactory...");
		BeanDefinition beanDefinition = configurableListableBeanFactory.getBeanDefinition("courseService");
		beanDefinition.setBeanClassName("com.itheima.spring.service.TagService");
		beanDefinition.setScope(BeanDefinition.SCOPE_SINGLETON);
		beanDefinition.setFactoryBeanName(null);
		beanDefinition.setFactoryMethodName(null);
	}
}
